<form enctype="application/x-www-form-urlencoded" action="<?=Zend_Controller_Front::getInstance()->getRequest()->getRequestUri()?>" method="post">
<?=$this->form->date?>
<?=$this->form->food_intake_code?>


<table cellpadding="5" id="products">
    <tr>
        <td>Продукт</td><td>Граммы</td>
        <td></td>
        <td></td>
    </tr>
    <tr>
    <?php 
    
    $columns = 2; $i = 1; $rows = (count($this->form->getElements()) - 3) / 2;
    foreach ($this->form->getElements() as $element) {
        if (in_array($element->getName(), 
            array('date', 'food_intake_code', 'submit'))) 
        {
            continue;
        }
        ?><td>
        <?=$this->formText($element->getName(), $element->getValue(), $element->getAttribs())?>
        <?php 
            if ($element->hasErrors()) :
                echo $this->formErrors($element->getMessages());
            endif;
        ?>
        </td><?php
        
        if (0 == $i % $columns) {
            ?>
            <td><span class="add ui-state-active ui-icon ui-icon-plusthick"></span></td>
            <td><span class="remove ui-state-active ui-icon ui-icon-minusthick"></span></td>
            </tr>
            <?php if ($i < $rows) {?><tr><?php }?>
            
            <?php
        }
        $i++;
    }
?>
    
</table>
<?php
    echo $this->form->submit;
    ?>
    
</form>